package com.bh.fee.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.constant.Entity;
import com.bh.common.utils.DateUtils;
import com.bh.common.utils.SecurityUtils;
import com.bh.fee.domain.JcDeliveryPrice;
import com.bh.fee.mapper.JcDeliveryPriceMapper;
import com.bh.fee.service.IJcDeliveryPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 服务区域其他单价Service业务层处理
 * 
 * @author slx
 * @date 2023-07-07
 */
@Service
public class JcDeliveryPriceServiceImpl extends ServiceImpl<JcDeliveryPriceMapper, JcDeliveryPrice> implements IJcDeliveryPriceService
{
    @Autowired
    private JcDeliveryPriceMapper jcDeliveryPriceMapper;

    /**
     * 查询服务区域其他单价
     * 
     * @param id 服务区域其他单价主键
     * @return 服务区域其他单价
     */
    @Override
    public JcDeliveryPrice selectJcDeliveryPriceById(Long id)
    {
        return jcDeliveryPriceMapper.selectById(id);
    }

    /**
     * 查询服务区域其他单价列表
     * 
     * @param jcDeliveryPrice 服务区域其他单价
     * @return 服务区域其他单价
     */
    @Override
    public List<JcDeliveryPrice> selectJcDeliveryPriceList(JcDeliveryPrice jcDeliveryPrice)
    {
        return jcDeliveryPriceMapper.selectJcDeliveryPriceList(jcDeliveryPrice);
    }

    /**
     * 新增服务区域其他单价
     * 
     * @param jcDeliveryPrice 服务区域其他单价
     * @return 结果
     */
    @Override
    public int insertJcDeliveryPrice(JcDeliveryPrice jcDeliveryPrice)
    {
        jcDeliveryPrice.setStatus(Entity.ACTIVE);
        jcDeliveryPrice.setCreateName(SecurityUtils.getUsername());
        jcDeliveryPrice.setCreateTime(DateUtils.getNowDate());
        return jcDeliveryPriceMapper.insert(jcDeliveryPrice);
    }

    /**
     * 修改服务区域其他单价
     * 
     * @param jcDeliveryPrice 服务区域其他单价
     * @return 结果
     */
    @Override
    public int updateJcDeliveryPrice(JcDeliveryPrice jcDeliveryPrice)
    {
        return jcDeliveryPriceMapper.updateById(jcDeliveryPrice);
    }

    /**
     * 批量删除服务区域其他单价
     * 
     * @param ids 需要删除的服务区域其他单价主键
     * @return 结果
     */
    @Override
    public int deleteJcDeliveryPriceByIds(Long[] ids)
    {
        return jcDeliveryPriceMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除服务区域其他单价信息
     * 
     * @param id 服务区域其他单价主键
     * @return 结果
     */
    @Override
    public int deleteJcDeliveryPriceById(Long id)
    {
        return jcDeliveryPriceMapper.deleteById(id);
    }
}
